<template>
    <!--ASN明细-->
    <div id="AsnDetails">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" @pop="setdata"></v-details>
    </div>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "AsnDetails",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                rules: {},
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "table",
                            label: this.$t('bill.billTo'),
                            props: "bill_to",
                            tableConfig: [
                                {
                                    label: this.$t('bill.billTo'),
                                    prop: "bill_to_cust",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "name",
                                    input: "input",
                                }
                            ],
                            url: `/queryBillToList/${this.$store.state.wms}/`
                        },
                        {
                            type: "table",
                            label: "账单组",
                            props: "bill_group",
                            tableConfig: [
                                {
                                    label: this.$t('bill.billGroup'),
                                    prop: "bill_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "bill_group_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryBillingGroupList/${this.$store.state.wms}/`
                        },
                        {
                            type: "table",
                            label: "事件组",
                            props: "event_group",
                            tableConfig: [
                                {
                                    label: "事件组",
                                    prop: "event_group",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "event_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryEventList/${this.$store.state.wms}/`
                        },
                        {
                            type: "select",
                            label: this.$t('bill.wareHouse'),
                            props: "facility_id",
                            options: this.getOptions("getSelectCode/FACILITY_ID/NAME/BIC_FACILITY/1=1")
                        },
                    ]
                ]
            }
        },
        methods: {
            setdata(data, id, close, listId) {
                if (listId == '0' && id == "0") {
                    this.data.detailData.bill_to = data.bill_to_cust;
                } else if (listId == "0" && id == "1") {
                    this.data.detailData.bill_group = data.bill_group;
                } else if (listId == "0" && id == "2") {
                    this.data.detailData.event_group = data.event_group;
                }
                close(false);
            }
        },
        mounted() {

        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
